<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php 
	require_once("database.php");
	require_once("facebook_include1.php");
	?>


<?php
    require_once("./config.php");
    $me = $facebook->api('/me');
    $access_token = $facebook->getAccessToken();
    $user = $facebook->getUser();
	
	
?>
<?php
	login($access_token);
	$userId = get_uid_only($access_token);
	$conn = connectdb();
	$userName = getUserName($userId );
	closedb($conn);
	$receiverid = getReceiverId($userId);
	$conn = connectdb();
	$receivername = getUserName($receiverid);
	closedb($conn);
	$senderBalance = getBalance($userId);
	$friends = isFriends($userId, $receiverid);
	$gameDetails = getPairDetails($userId, $receiverid);
	$relation = $gameDetails['relation'];
	$anonymous = $gameDetails['anonymous'];
	$gametype = $gameDetails['gametype'];
	logEvent($userId, 0, 0, 11);	
	if($gametype == 2)
		header( 'Location: senderwithin.php') ;
?>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--block_head-->
<link href="App_Themes/Intel.com/grids-min.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<link href="App_Themes/Intel.com/v3.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!--object-specific stylesheets-->
<link href="App_Themes/Intel.com/downloads.css" rel="stylesheet" type="text/css">
<script language="javascript" src="App_Themes/scripts/scripts.js" type="text/javascript" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></script>
<script language="javascript" src="App_Themes/scripts/sliders.js" type="text/javascript" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></script>
<!--/object-specific stylesheets-->
<!--/block_head-->

<!-- Slider-->

<!-- Dependencies --> 
<script src="http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script src="http://yui.yahooapis.com/2.8.0r4/build/dragdrop/dragdrop-min.js"></script>

<!-- Slider skin (optional) --> 
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/slider/assets/skins/sam/slider.css">

<!-- Slider source file --> 
<script src="http://yui.yahooapis.com/2.8.0r4/build/slider/slider-min.js"></script>

<!-- /Slider -->

<!--Overlays-->
<!-- Sam Skin CSS -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/container/assets/skins/sam/container.css">

<!-- Dependencies -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js"></script>

<!-- Source file -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/container/container-min.js"></script>

<!--/Overlays-->

</head>
<body>
<div id="doc" style="width:700px; padding-left:0px; margin-left:0px"> 
	   <div id="bd">
	   		<div id="yui-main"> 
				<div class="yui-b">
					<!--div class="yui-g"-->
						<div class="pageHeading" style="padding:15px 10px 15px 0px;">Now it's Time to Play the Game</div>
						<div style="padding:0px 0px 15px 0px;">
							<p class="font4">Want to know how to play this game? <a href="javascript:void(0)" onclick = "javascript:window.open('help.php', 'help')"> Click Here </a></p>
						</div>
						<div style="padding:0px 0px 15px 0px;">
									 <?php
									 	$friendMsg = '';
									 	if($anonymous){
											if($relation == 1){
												$friendmsg = 'You are paired with an <strong>anonymous facebook user.</strong> ';
											}else if($relation == 2 || $relation == 3){
												$friendMsg = 'You are paired with an <strong>anonymous facebook friend.</strong> ';	
											}else if($relation == 4){
												$friendMsg = 'You are paired with an <strong>anonymous facebook user you is a friend of one of your friends.</strong> ';
											}
										}else{
											if($relation == 1){
												$friendMsg = 'You are paired with <a href="http://www.facebook.com/profile.php?id='. $receiverid . '">'. getName($receiverid) . '</a>. ';
											}else if($relation == 2){
												$friendMsg = 'You are paired with <strong>your friend</strong> <a href="http://www.facebook.com/profile.php?id='.$receiverid.'">'. getName($receiverid) . '</a>. <strong>Note that you do not share any mutual friends with ' . getName($receiverid) . '.</strong> ';	
											}else if($relation == 3){
												$friendMsg = 'You are with <strong>your friend</strong> <a href="http://www.facebook.com/profile.php?id='.$receiverid.'">'. getName($receiverid) . '</a>. ';	
											}else if($relation == 4){
												$friendMsg = 'You are paired with <a href="http://www.facebook.com/profile.php?id='. $receiverid . '">'. getName($receiverid) . '</a> who is a <strong>friend of one of your friends.</strong> ';
											}
										}
									 ?>
                            <p class="font4">You have been assigned the role of SENDER. <?php echo $friendMsg ?></p>
                            <p class="font4">You have <?php echo currency ?><?php echo $senderBalance?> in your account. Please send any amount between <?php echo currency ?>0 and <?php echo currency ?><?php echo $senderBalance?>.</p>
                            <input type="hidden" name="balance" id="balance" value='<?php echo $senderBalance?>'/>
                            <br/>
                        </div>
						<div class="subSection">
							<span class="optional">*</span> <strong id="Name" class="sectionBodyText">Please enter the amount to transfer. </strong><span class="sectionBodyText">You have <?php echo currency ?><?php echo $senderBalance?> in your account.</span><br/>
						</div>
					<!--/div-->
					<div class="yui-gb">
						<div class="yui-u first">
							&nbsp;
						</div>
						<form id="sendform" name="sendform" action = "send done.php" method = "get">
						<div class="yui-u">
								<input type="text" id="moneySent" name="moneySent" style="width:100px"/>
						</div>
						<div class="yui-u">
							<input type="button" name="btnsearch" id="btnsearch" value="    Send &gt;    " class="search" style="margin-left:-6.5px" onclick="javascript:validateSendForm(<?php echo isdollars ?>);"/><br />
							<div class="sectionBodyText font4"><span class="info" id="senderError" style="display:none">Please wait ...</span></div>
						</div>
						</form>
					</div>
				</div>
	   		</div> 
	   </div>  
</div> 

<div id="sendConfirm" class="yui-panel moreinfo sectionBodyText centerPopUp" style="display:none;">
    <div style="padding-bottom:15px; padding-left:20px; padding-top:7px;">    
        <div class="sectionHeading">Send?</div>	<br/>
        <span class="heading"> Are you sure you want to send <?php echo currency ?><span id="confirmMoney"></span>?<br /><br /></span>
	    <input type="button" value="Yes" class="search" style="height:25px" onClick="javascript:submitSendForm();"/>
	    <input type="button" value="No" class="search" style="height:25px; margin-left:50px;" onClick="javascript:closeConfirm();"/>
        <br/>
    </div>
</div>
<script language="javascript">
	sliderInit();
</script> 
</body>
</html>
